fix(tui): copy selection on Cmd+C when copy-on-select is disabled#27059
fix(tui): copy selection on Cmd+C when copy-on-select is disabled#27059astron8t-voyagerx wants to merge 1 commit into
Conversation
handleSelectionKey only matched event.ctrl, so on macOS with Kitty Keyboard Protocol (Ghostty, Kitty, WezTerm) Cmd+C arrived as event.super and fell through to renderer.clearSelection(), wiping the highlight without copying. Accept meta and super in addition to ctrl. Fixes anomalyco#27058 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
|
Is this still going to be a thing? I can confirm the bug still exists in the most recent version. |
|
Automated PR Cleanup Thank you for contributing to opencode. Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions. This PR was closed because it matched the following cleanup criteria:
PRs created within the last month are not affected by this cleanup. If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate. Thanks again for taking the time to contribute. |
Issue for this PR
Closes #27058
Type of change
What does this PR do?
In
handleSelectionKey(packages/opencode/src/cli/cmd/tui/util/selection.ts), the copy shortcut only matchedevent.ctrl. opencode enables the Kitty Keyboard Protocol (useKittyKeyboard: {}inapp.tsx), so macOS Cmd+C reaches the app asevent.super— but no branch matched, and the function fell through torenderer.clearSelection(), wiping the highlight without copying.Fix: accept
metaandsuperin addition toctrl. TheSelectionKeyEventtype is widened to mirror the actualKeyEventshape from@opentui/core/lib/KeyHandler.Follow-up to #4996, which introduced the flag.
How did you verify your code works?
parseKittyKeyboardsetskey.super = truewhen Cmd is held (modifier bit 8 infromKittyMods). The widened condition matches it.bun turbo typecheck— 14/14 successful).OPENCODE_EXPERIMENTAL_DISABLE_COPY_ON_SELECT=1: drag-select → Cmd+C copies to clipboard and shows the "Copied to clipboard" toast. Ctrl+C still works (no regression). Without the env var, the existing copy-on-select behavior is unchanged.Screenshots / recordings
N/A — not a visual change.
Checklist